home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / CardServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  30.9 KB  |  913 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CardServices.h
  3.  
  4.      Contains:    The client interface to Card and Socket Services.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1994-1997 by Apple Computer, Inc. All rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CARDSERVICES__
  19. #define __CARDSERVICES__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __PCCARDTUPLES__
  25. #include <PCCardTuples.h>
  26. #endif
  27. #ifndef __MIXEDMODE__
  28. #include <MixedMode.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /*    miscellaneous*/
  54.  
  55.  
  56. enum {
  57.     CS_MAX_SOCKETS                = 32                            /* a long is used as a socket bitmap*/
  58. };
  59.  
  60.  
  61. /* Will move to <Traps.h>*/
  62.  
  63. enum {
  64.     _PCCardDispatch                = 0xAAF0                        /* Card Services entry trap*/
  65. };
  66.  
  67. /* Will move to <Errors.h>*/
  68.  
  69. /*    result codes*/
  70.  
  71.  
  72. enum {
  73.     kCSBadAdapterErr            = -9050,                        /* invalid adapter number*/
  74.     kCSBadAttributeErr            = -9051,                        /* specified attributes field value is invalid*/
  75.     kCSBadBaseErr                = -9052,                        /* specified base system memory address is invalid*/
  76.     kCSBadEDCErr                = -9053,                        /* specified EDC generator specified is invalid*/
  77.     kCSBadIRQErr                = -9054,                        /* specified IRQ level is invalid*/
  78.     kCSBadOffsetErr                = -9055,                        /* specified PC card memory array offset is invalid*/
  79.     kCSBadPageErr                = -9056,                        /* specified page is invalid*/
  80.     kCSBadSizeErr                = -9057,                        /* specified size is invalid*/
  81.     kCSBadSocketErr                = -9058,                        /* specified logical or physical socket number is invalid*/
  82.     kCSBadTypeErr                = -9059,                        /* specified window or interface type is invalid*/
  83.     kCSBadVccErr                = -9060,                        /* specified Vcc power level index is invalid*/
  84.     kCSBadVppErr                = -9061,                        /* specified Vpp1 or Vpp2 power level index is invalid*/
  85.     kCSBadWindowErr                = -9062,                        /* specified window is invalid*/
  86.     kCSBadArgLengthErr            = -9063,                        /* ArgLength argument is invalid*/
  87.     kCSBadArgsErr                = -9064,                        /* values in argument packet are invalid*/
  88.     kCSBadHandleErr                = -9065,                        /* clientHandle is invalid*/
  89.     kCSBadCISErr                = -9066,                        /* CIS on card is invalid*/
  90.     kCSBadSpeedErr                = -9067,                        /* specified speed is unavailable*/
  91.     kCSReadFailureErr            = -9068,                        /* unable to complete read request*/
  92.     kCSWriteFailureErr            = -9069,                        /* unable to complete write request*/
  93.     kCSGeneralFailureErr        = -9070,                        /* an undefined error has occurred*/
  94.     kCSNoCardErr                = -9071,                        /* no PC card in the socket*/
  95.     kCSUnsupportedFunctionErr    = -9072,                        /* function is not supported by this implementation*/
  96.     kCSUnsupportedModeErr        = -9073,                        /* mode is not supported*/
  97.     kCSBusyErr                    = -9074,                        /* unable to process request at this time - try later*/
  98.     kCSWriteProtectedErr        = -9075,                        /* media is write-protected*/
  99.     kCSConfigurationLockedErr    = -9076,                        /* a configuration has already been locked*/
  100.     kCSInUseErr                    = -9077,                        /* requested resource is being used by a client*/
  101.     kCSNoMoreItemsErr            = -9078,                        /* there are no more of the requested item*/
  102.     kCSOutOfResourceErr            = -9079                            /* Card Services has exhausted the resource*/
  103. };
  104.  
  105.  
  106.  
  107. /*    messages sent to client's event handler*/
  108.  
  109.  
  110. enum {
  111.     kCSNullMessage                = 0x00,                            /* no messages pending (not sent to clients)*/
  112.     kCSCardInsertionMessage        = 0x01,                            /* card has been inserted into the socket*/
  113.     kCSCardRemovalMessage        = 0x02,                            /* card has been removed from the socket*/
  114.     kCSCardLockMessage            = 0x03,                            /* card is locked into the socket with a mechanical latch*/
  115.     kCSCardUnlockMessage        = 0x04,                            /* card is no longer locked into the socket*/
  116.     kCSCardReadyMessage            = 0x05,                            /* card is ready to be accessed*/
  117.     kCSCardResetMessage            = 0x06,                            /* physical reset has completed*/
  118.     kCSInsertionRequestMessage    = 0x07,                            /* request to insert a card using insertion motor*/
  119.     kCSInsertionCompleteMessage    = 0x08,                            /* insertion motor has finished inserting a card*/
  120.     kCSEjectionRequestMessage    = 0x09,                            /* user or other client is requesting a card ejection*/
  121.     kCSEjectionFailedMessage    = 0x0A,                            /* eject failure due to electrical/mechanical problems*/
  122.     kCSPMResumeMessage            = 0x0B,                            /* power management resume (TBD)*/
  123.     kCSPMSuspendMessage            = 0x0C,                            /* power management suspend (TBD)*/
  124.     kCSResetPhysicalMessage        = 0x0D,                            /* physical reset is about to occur on this card*/
  125.     kCSResetRequestMessage        = 0x0E,                            /* physical reset has been requested by a client*/
  126.     kCSResetCompleteMessage        = 0x0F,                            /* ResetCard() background reset has completed*/
  127.     kCSBatteryDeadMessage        = 0x10,                            /* battery is no longer useable, data will be lost*/
  128.     kCSBatteryLowMessage        = 0x11,                            /* battery is weak and should be replaced*/
  129.     kCSWriteProtectMessage        = 0x12,                            /* card is now write protected*/
  130.     kCSWriteEnabledMessage        = 0x13,                            /* card is now write enabled*/
  131.     kCSClientInfoMessage        = 0x14,                            /* client is to return client information*/
  132.     kCSSSUpdatedMessage            = 0x15,                            /* AddSocketServices/ReplaceSocket services has changed SS support*/
  133.     kCSFunctionInterruptMessage    = 0x16,                            /* card function interrupt*/
  134.     kCSAccessErrorMessage        = 0x17,                            /* client bus errored on access to socket*/
  135.     kCSCardUnconfiguredMessage    = 0x18,                            /* a CARD_READY was delivered to all clients and no client */
  136.                                                                 /*    requested a configuration for the socket*/
  137.     kCSStatusChangedMessage        = 0x19                            /* status change for cards in I/O mode*/
  138. };
  139.  
  140. /*
  141.     The following is a mapping of the PCMCIA name space to the Macintosh name space.
  142.     These two enum lists will be removed and given to developers as a separate file.
  143. */
  144.  
  145. enum {
  146.     SUCCESS                        = noErr,
  147.     BAD_ADAPTER                    = kCSBadAdapterErr,
  148.     BAD_ATTRIBUTE                = kCSBadAttributeErr,
  149.     BAD_BASE                    = kCSBadBaseErr,
  150.     BAD_EDC                        = kCSBadEDCErr,
  151.     BAD_IRQ                        = kCSBadIRQErr,
  152.     BAD_OFFSET                    = kCSBadOffsetErr,
  153.     BAD_PAGE                    = kCSBadPageErr,
  154.     BAD_SIZE                    = kCSBadSizeErr,
  155.     BAD_SOCKET                    = kCSBadSocketErr,
  156.     BAD_TYPE                    = kCSBadTypeErr,
  157.     BAD_VCC                        = kCSBadVccErr,
  158.     BAD_VPP                        = kCSBadVppErr,
  159.     BAD_WINDOW                    = kCSBadWindowErr,
  160.     BAD_ARG_LENGTH                = kCSBadArgLengthErr,
  161.     BAD_ARGS                    = kCSBadArgsErr,
  162.     BAD_HANDLE                    = kCSBadHandleErr,
  163.     BAD_CIS                        = kCSBadCISErr,
  164.     BAD_SPEED                    = kCSBadSpeedErr,
  165.     READ_FAILURE                = kCSReadFailureErr,
  166.     WRITE_FAILURE                = kCSWriteFailureErr,
  167.     GENERAL_FAILURE                = kCSGeneralFailureErr,
  168.     NO_CARD                        = kCSNoCardErr,
  169.     UNSUPPORTED_FUNCTION        = kCSUnsupportedFunctionErr,
  170.     UNSUPPORTED_MODE            = kCSUnsupportedModeErr,
  171.     BUSY                        = kCSBusyErr,
  172.     WRITE_PROTECTED                = kCSWriteProtectedErr,
  173.     CONFIGURATION_LOCKED        = kCSConfigurationLockedErr,
  174.     IN_USE                        = kCSInUseErr,
  175.     NO_MORE_ITEMS                = kCSNoMoreItemsErr,
  176.     OUT_OF_RESOURCE                = kCSOutOfResourceErr
  177. };
  178.  
  179.  
  180. /*    messages sent to client's event handler*/
  181.  
  182.  
  183. enum {
  184.     NULL_MESSAGE                = kCSNullMessage,
  185.     CARD_INSERTION                = kCSCardInsertionMessage,
  186.     CARD_REMOVAL                = kCSCardRemovalMessage,
  187.     CARD_LOCK                    = kCSCardLockMessage,
  188.     CARD_UNLOCK                    = kCSCardUnlockMessage,
  189.     CARD_READY                    = kCSCardReadyMessage,
  190.     CARD_RESET                    = kCSCardResetMessage,
  191.     INSERTION_REQUEST            = kCSInsertionRequestMessage,
  192.     INSERTION_COMPLETE            = kCSInsertionCompleteMessage,
  193.     EJECTION_REQUEST            = kCSEjectionRequestMessage,
  194.     EJECTION_FAILED                = kCSEjectionFailedMessage,
  195.     PM_RESUME                    = kCSPMResumeMessage,
  196.     PM_SUSPEND                    = kCSPMSuspendMessage,
  197.     RESET_PHYSICAL                = kCSResetPhysicalMessage,
  198.     RESET_REQUEST                = kCSResetRequestMessage,
  199.     RESET_COMPLETE                = kCSResetCompleteMessage,
  200.     BATTERY_DEAD                = kCSBatteryDeadMessage,
  201.     BATTERY_LOW                    = kCSBatteryLowMessage,
  202.     WRITE_PROTECT                = kCSWriteProtectMessage,
  203.     WRITE_ENABLED                = kCSWriteEnabledMessage,
  204.     CLIENT_INFO                    = kCSClientInfoMessage,
  205.     SS_UPDATED                    = kCSSSUpdatedMessage,
  206.     FUNCTION_INTERRUPT            = kCSFunctionInterruptMessage,
  207.     ACCESS_ERROR                = kCSAccessErrorMessage,
  208.     CARD_UNCONFIGURED            = kCSCardUnconfiguredMessage,
  209.     STATUS_CHANGED                = kCSStatusChangedMessage
  210. };
  211.  
  212.  
  213. /*----------------        CSAccessConfigurationRegister    ----------------*/
  214.  
  215. struct AccessConfigurationRegisterPB {
  216.     UInt16                             socket;                        /*  -> global socket number*/
  217.     UInt8                             action;                        /*  -> read/write*/
  218.     UInt8                             offset;                        /*  -> offset from config register base*/
  219.     UInt8                             value;                        /* <-> value to read/write*/
  220.     UInt8                             padding[1];                    /* */
  221. };
  222. typedef struct AccessConfigurationRegisterPB AccessConfigurationRegisterPB;
  223.  
  224. /*    ‘action’ field values*/
  225.  
  226.  
  227. enum {
  228.     kCSReadConfigRegister        = 0x00,
  229.     kCSWriteConfigRegister        = 0x01
  230. };
  231.  
  232.  
  233. /*----------------        CSGetCardServicesInfo            ----------------*/
  234.  
  235. struct GetCardServicesInfoPB {
  236.     UInt8                             signature[2];                /* <-  two ascii chars 'CS'*/
  237.     UInt16                             count;                        /* <-  total number of sockets installed*/
  238.     UInt16                             revision;                    /* <-  BCD*/
  239.     UInt16                             csLevel;                    /* <-  BCD*/
  240.     UInt16                             reserved;                    /*  -> zero*/
  241.     UInt16                             vStrLen;                    /* <-> in: client's buffer size, out: vendor string length*/
  242.     UInt8 *                            vendorString;                /* <-> in: pointer to buffer to hold CS vendor string (zero-terminated)*/
  243.                                                                 /*      out: CS vendor string copied to buffer*/
  244. };
  245. typedef struct GetCardServicesInfoPB GetCardServicesInfoPB;
  246.  
  247. /*----------------        CSGetClientInfo                    ----------------*/
  248.  
  249.  
  250. /* upper byte of attributes is kCSClientInfoSubfunction*/
  251. struct ClientInfoParam {
  252.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  253.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  254.     UInt16                             revision;                    /* <-  BCD value of client's revision*/
  255.     UInt16                             csLevel;                    /* <-  BCD value of CS release*/
  256.     UInt16                             revDate;                    /* <-  revision date: y[15-9], m[8-5], d[4-0]*/
  257.     SInt16                             nameLen;                    /* <-> in: max length of client name string, out: actual length*/
  258.     SInt16                             vStringLen;                    /* <-> in: max length of vendor string, out: actual length*/
  259.     UInt8 *                            nameString;                    /* <-  pointer to client name string (zero-terminated)*/
  260.     UInt8 *                            vendorString;                /* <-  pointer to vendor string (zero-terminated)*/
  261. };
  262. typedef struct ClientInfoParam ClientInfoParam;
  263.  
  264. /*
  265.    upper byte of attributes is kCSCardNameSubfunction,
  266.                                  kCSCardTypeSubfunction,
  267.                                  kCSHelpStringSubfunction
  268. */
  269. struct AlternateTextStringParam {
  270.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  271.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  272.     UInt16                             socket;                        /*  -> logical socket number*/
  273.     UInt16                             reserved;                    /*  -> zero*/
  274.     SInt16                             length;                        /* <-> in: max length of string, out: actual length*/
  275.     UInt8 *                            text;                        /* <-  pointer to string (zero-terminated)*/
  276. };
  277. typedef struct AlternateTextStringParam AlternateTextStringParam;
  278.  
  279. /* upper byte of attributes is kCSCardIconSubfunction*/
  280. struct AlternateCardIconParam {
  281.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  282.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  283.     UInt16                             socket;                        /*  -> logical socket number*/
  284.     Handle                             iconSuite;                    /* <-  handle to icon suite containing all icons*/
  285. };
  286. typedef struct AlternateCardIconParam AlternateCardIconParam;
  287.  
  288. /* upper byte of attributes is kCSActionProcSubfunction*/
  289. struct CustomActionProcParam {
  290.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  291.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  292.     UInt16                             socket;                        /*  -> logical socket number*/
  293. };
  294. typedef struct CustomActionProcParam CustomActionProcParam;
  295.  
  296. struct GetClientInfoPB {
  297.     union {
  298.         ClientInfoParam                 clientInfo;
  299.         AlternateTextStringParam         alternateTextString;
  300.         AlternateCardIconParam             alternateIcon;
  301.         CustomActionProcParam             customActionProc;
  302.     }                                 u;
  303. };
  304. typedef struct GetClientInfoPB GetClientInfoPB;
  305.  
  306. /*    ‘attributes’ field values*/
  307.  
  308. enum {
  309.     kCSMemoryClient                = 0x0001,
  310.     kCSIOClient                    = 0x0004,
  311.     kCSClientTypeMask            = 0x0007,
  312.     kCSShareableCardInsertEvents = 0x0008,
  313.     kCSExclusiveCardInsertEvents = 0x0010,
  314.     kCSInfoSubfunctionMask        = 0xFF00,
  315.     kCSClientInfoSubfunction    = 0x0000,
  316.     kCSCardNameSubfunction        = 0x8000,
  317.     kCSCardTypeSubfunction        = 0x8100,
  318.     kCSHelpStringSubfunction    = 0x8200,
  319.     kCSCardIconSubfunction        = 0x8300,
  320.     kCSActionProcSubfunction    = 0x8400
  321. };
  322.  
  323.  
  324. /*
  325.   ----------------        CSGetConfigurationInfo            ----------------
  326.   ----------------        CSModifyConfiguration            ----------------
  327.   ----------------        CSRequestConfiguration            ----------------
  328. */
  329.  
  330. struct GetModRequestConfigInfoPB {
  331.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  332.     UInt16                             socket;                        /*  -> logical socket number*/
  333.     UInt16                             attributes;                    /* <-> bitmap of configuration attributes*/
  334.     UInt8                             vcc;                        /* <-> Vcc setting*/
  335.     UInt8                             vpp1;                        /* <-> Vpp1 setting*/
  336.     UInt8                             vpp2;                        /* <-> Vpp2 setting*/
  337.     UInt8                             intType;                    /* <-> interface type (memory or memory+I/O)*/
  338.     UInt32                             configBase;                    /* <-> card base address of configuration registers*/
  339.     UInt8                             status;                        /* <-> card status register setting, if present*/
  340.     UInt8                             pin;                        /* <-> card pin register setting, if present*/
  341.     UInt8                             copy;                        /* <-> card socket/copy register setting, if present*/
  342.     UInt8                             configIndex;                /* <-> card option register setting, if present*/
  343.     UInt8                             present;                    /* <-> bitmap of which configuration registers are present*/
  344.     UInt8                             firstDevType;                /* <-  from DeviceID tuple*/
  345.     UInt8                             funcCode;                    /* <-  from FuncID tuple*/
  346.     UInt8                             sysInitMask;                /* <-  from FuncID tuple*/
  347.     UInt16                             manufCode;                    /* <-  from ManufacturerID tuple*/
  348.     UInt16                             manufInfo;                    /* <-  from ManufacturerID tuple*/
  349.     UInt8                             cardValues;                    /* <-  valid card register values*/
  350.     UInt8                             padding[1];                    /* */
  351. };
  352. typedef struct GetModRequestConfigInfoPB GetModRequestConfigInfoPB;
  353.  
  354. /*    ‘attributes’ field values*/
  355.  
  356. enum {
  357.     kCSExclusivelyUsed            = 0x0001,
  358.     kCSEnableIREQs                = 0x0002,
  359.     kCSVccChangeValid            = 0x0004,
  360.     kCSVpp1ChangeValid            = 0x0008,
  361.     kCSVpp2ChangeValid            = 0x0010,
  362.     kCSValidClient                = 0x0020,
  363.     kCSSleepPower                = 0x0040,                        /* request that power be applied to socket during Sleep*/
  364.     kCSLockSocket                = 0x0080,
  365.     kCSTurnOnInUse                = 0x0100
  366. };
  367.  
  368. /*    ‘intType’ field values*/
  369.  
  370.  
  371. enum {
  372.     kCSMemoryInterface            = 0x01,
  373.     kCSMemory_And_IO_Interface    = 0x02
  374. };
  375.  
  376. /*    ‘present’ field values*/
  377.  
  378.  
  379. enum {
  380.     kCSOptionRegisterPresent    = 0x01,
  381.     kCSStatusRegisterPresent    = 0x02,
  382.     kCSPinReplacementRegisterPresent = 0x04,
  383.     kCSCopyRegisterPresent        = 0x08
  384. };
  385.  
  386. /*    ‘cardValues’ field values*/
  387.  
  388.  
  389. enum {
  390.     kCSOptionValueValid            = 0x01,
  391.     kCSStatusValueValid            = 0x02,
  392.     kCSPinReplacementValueValid    = 0x04,
  393.     kCSCopyValueValid            = 0x08
  394. };
  395.  
  396.  
  397. /*
  398.   ----------------        CSGetClientEventMask            ----------------
  399.   ----------------        CSSetClientEventMask            ----------------
  400. */
  401.  
  402. struct GetSetClientEventMaskPB {
  403.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  404.     UInt16                             attributes;                    /* <-> bitmap of attributes*/
  405.     UInt16                             eventMask;                    /* <-> bitmap of events to be passed to client for this socket*/
  406.     UInt16                             socket;                        /*  -> logical socket number*/
  407. };
  408. typedef struct GetSetClientEventMaskPB GetSetClientEventMaskPB;
  409.  
  410. /*    ‘attributes’ field values*/
  411.  
  412. enum {
  413.     kCSEventMaskThisSocketOnly    = 0x0001
  414. };
  415.  
  416. /*    ‘eventMask’ field values*/
  417.  
  418.  
  419. enum {
  420.     kCSWriteProtectEvent        = 0x0001,
  421.     kCSCardLockChangeEvent        = 0x0002,
  422.     kCSEjectRequestEvent        = 0x0004,
  423.     kCSInsertRequestEvent        = 0x0008,
  424.     kCSBatteryDeadEvent            = 0x0010,
  425.     kCSBatteryLowEvent            = 0x0020,
  426.     kCSReadyChangeEvent            = 0x0040,
  427.     kCSCardDetectChangeEvent    = 0x0080,
  428.     kCSPMChangeEvent            = 0x0100,
  429.     kCSResetEvent                = 0x0200,
  430.     kCSSSUpdateEvent            = 0x0400,
  431.     kCSFunctionInterrupt        = 0x0800,
  432.     kCSAllEvents                = 0xFFFF
  433. };
  434.  
  435.  
  436. /*
  437.   ----------------        CSGetFirstClient                ----------------
  438.   ----------------        CSGetNextClient                    ----------------
  439. */
  440.  
  441. struct GetClientPB {
  442.     UInt32                             clientHandle;                /* <-  clientHandle for this client*/
  443.     UInt16                             socket;                        /*  -> logical socket number*/
  444.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  445. };
  446. typedef struct GetClientPB GetClientPB;
  447.  
  448. /*    ‘attributes’ field values*/
  449.  
  450. enum {
  451.     kCSClientsForAllSockets        = 0x0000,
  452.     kCSClientsThisSocketOnly    = 0x0001
  453. };
  454.  
  455.  
  456. /*
  457.   ----------------        CSGetFirstTuple                    ----------------
  458.   ----------------        CSGetNextTuple                    ----------------
  459.   ----------------        CSGetTupleData                    ----------------
  460. */
  461.  
  462. struct GetTuplePB {
  463.     UInt16                             socket;                        /*  -> logical socket number*/
  464.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  465.     UInt8                             desiredTuple;                /*  -> desired tuple code value, or $FF for all*/
  466.     UInt8                             tupleOffset;                /*  -> offset into tuple from link byte*/
  467.     UInt16                             flags;                        /* <-> internal use*/
  468.     UInt32                             linkOffset;                    /* <-> internal use*/
  469.     UInt32                             cisOffset;                    /* <-> internal use*/
  470.  
  471.     union {
  472.         struct {
  473.             UInt8                             tupleCode;            /* <-  tuple code found*/
  474.             UInt8                             tupleLink;            /* <-  link value for tuple found*/
  475.         }                                 TuplePB;
  476.  
  477.         struct {
  478.             UInt16                             tupleDataMax;        /*  -> maximum size of tuple data area*/
  479.             UInt16                             tupleDataLen;        /* <-  number of bytes in tuple body*/
  480.             TupleBody                         tupleData;            /* <-  tuple data*/
  481.         }                                 TupleDataPB;
  482.     }                                 u;
  483. };
  484. typedef struct GetTuplePB GetTuplePB;
  485.  
  486. /*    ‘attributes’ field values*/
  487.  
  488. enum {
  489.     kCSReturnLinkTuples            = 0x0001
  490. };
  491.  
  492.  
  493. /*
  494.   ----------------        CSRequestSocketMask                ----------------
  495.   ----------------        CSReleaseSocketMask                ----------------
  496. */
  497.  
  498. struct ReqRelSocketMaskPB {
  499.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  500.     UInt16                             socket;                        /*  -> logical socket*/
  501.     UInt16                             eventMask;                    /*  -> bitmap of events to be passed to client for this socket*/
  502. };
  503. typedef struct ReqRelSocketMaskPB ReqRelSocketMaskPB;
  504.  
  505. /*    ‘eventMask’ field values (see above for Get/SetClientEventMask*/
  506.  
  507. /*----------------        CSGetStatus                        ----------------*/
  508.  
  509. struct GetStatusPB {
  510.     UInt16                             socket;                        /*  -> logical socket number*/
  511.     UInt16                             cardState;                    /* <-  current state of installed card*/
  512.     UInt16                             socketState;                /* <-  current state of the socket*/
  513. };
  514. typedef struct GetStatusPB GetStatusPB;
  515.  
  516. /*    ‘cardState’ field values*/
  517.  
  518. enum {
  519.     kCSWriteProtected            = 0x0001,
  520.     kCSCardLocked                = 0x0002,
  521.     kCSEjectRequest                = 0x0004,
  522.     kCSInsertRequest            = 0x0008,
  523.     kCSBatteryDead                = 0x0010,
  524.     kCSBatteryLow                = 0x0020,
  525.     kCSReady                    = 0x0040,
  526.     kCSCardDetected                = 0x0080
  527. };
  528.  
  529. /*    ‘socketState’ field values*/
  530.  
  531.  
  532. enum {
  533.     kCSWriteProtectChanged        = 0x0001,
  534.     kCSCardLockChanged            = 0x0002,
  535.     kCSEjectRequestPending        = 0x0004,
  536.     kCSInsertRequestPending        = 0x0008,
  537.     kCSBatteryDeadChanged        = 0x0010,
  538.     kCSBatteryLowChanged        = 0x0020,
  539.     kCSReadyChanged                = 0x0040,
  540.     kCSCardDetectChanged        = 0x0080
  541. };
  542.  
  543.  
  544. /*
  545.   ----------------        CSModifyWindow                    ----------------
  546.   ----------------        CSReleaseWindow                    ----------------
  547.   ----------------        CSRequestWindow                    ----------------
  548. */
  549.  
  550. struct ReqModRelWindowPB {
  551.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  552.     UInt32                             windowHandle;                /* <-> window descriptor*/
  553.     UInt16                             socket;                        /*  -> logical socket number*/
  554.     UInt16                             attributes;                    /*  -> window attributes (bitmap)*/
  555.     UInt32                             base;                        /* <-> system base address*/
  556.     UInt32                             size;                        /* <-> memory window size*/
  557.     UInt8                             accessSpeed;                /*  -> window access speed (bitmap)*/
  558.                                                                 /*        (not applicable for I/O mode)*/
  559.     UInt8                             padding[1];                    /* */
  560. };
  561. typedef struct ReqModRelWindowPB ReqModRelWindowPB;
  562.  
  563. /*    ‘attributes’ field values*/
  564.  
  565. enum {
  566.     kCSMemoryWindow                = 0x0001,
  567.     kCSIOWindow                    = 0x0002,
  568.     kCSAttributeWindow            = 0x0004,                        /* not normally used by Card Services clients*/
  569.     kCSWindowTypeMask            = 0x0007,
  570.     kCSEnableWindow                = 0x0008,
  571.     kCSAccessSpeedValid            = 0x0010,
  572.     kCSLittleEndian                = 0x0020,                        /* configure socket for little endianess*/
  573.     kCS16BitDataPath            = 0x0040,
  574.     kCSWindowPaged                = 0x0080,                        /* */
  575.     kCSWindowShared                = 0x0100,
  576.     kCSWindowFirstShared        = 0x0200,                        /* */
  577.     kCSWindowProgrammable        = 0x0400                        /* */
  578. };
  579.  
  580. /*    ‘accessSpeed’ field values*/
  581.  
  582.  
  583. enum {
  584.     kCSDeviceSpeedCodeMask        = 0x07,
  585.     kCSSpeedExponentMask        = 0x07,
  586.     kCSSpeedMantissaMask        = 0x78,
  587.     kCSUseWait                    = 0x80,
  588.     kCSAccessSpeed250nsec        = 0x01,
  589.     kCSAccessSpeed200nsec        = 0x02,
  590.     kCSAccessSpeed150nsec        = 0x03,
  591.     kCSAccessSpeed100nsec        = 0x04,
  592.     kCSExtAccSpeedMant1pt0        = 0x01,
  593.     kCSExtAccSpeedMant1pt2        = 0x02,
  594.     kCSExtAccSpeedMant1pt3        = 0x03,
  595.     kCSExtAccSpeedMant1pt5        = 0x04,
  596.     kCSExtAccSpeedMant2pt0        = 0x05,
  597.     kCSExtAccSpeedMant2pt5        = 0x06,
  598.     kCSExtAccSpeedMant3pt0        = 0x07,
  599.     kCSExtAccSpeedMant3pt5        = 0x08,
  600.     kCSExtAccSpeedMant4pt0        = 0x09,
  601.     kCSExtAccSpeedMant4pt5        = 0x0A,
  602.     kCSExtAccSpeedMant5pt0        = 0x0B,
  603.     kCSExtAccSpeedMant5pt5        = 0x0C,
  604.     kCSExtAccSpeedMant6pt0        = 0x0D,
  605.     kCSExtAccSpeedMant7pt0        = 0x0E,
  606.     kCSExtAccSpeedMant8pt0        = 0x0F,
  607.     kCSExtAccSpeedExp1ns        = 0x00,
  608.     kCSExtAccSpeedExp10ns        = 0x01,
  609.     kCSExtAccSpeedExp100ns        = 0x02,
  610.     kCSExtAccSpeedExp1us        = 0x03,
  611.     kCSExtAccSpeedExp10us        = 0x04,
  612.     kCSExtAccSpeedExp100us        = 0x05,
  613.     kCSExtAccSpeedExp1ms        = 0x06,
  614.     kCSExtAccSpeedExp10ms        = 0x07
  615. };
  616.  
  617.  
  618. /*
  619.   ----------------        CSRegisterClient                ----------------
  620.   ----------------        CSDeregisterClient                ----------------
  621. */
  622.  
  623. struct ClientCallbackPB {
  624.     UInt16                             message;                    /*  -> which event this is*/
  625.     UInt16                             socket;                        /*  -> logical socket number*/
  626.     UInt16                             info;                        /*  -> function-specific*/
  627.     UInt16                             misc;                        /*  -> function-specific*/
  628.     Ptr                             reserved;                    /*  -> pointer to MTD request block*/
  629.     Ptr                             buffer;                        /*  -> function-specific*/
  630.     Ptr                             clientData;                    /*  -> pointer to client's data (from RegisterClient)*/
  631. };
  632. typedef struct ClientCallbackPB ClientCallbackPB;
  633.  
  634. typedef ClientCallbackPB *                ClientCallbackPBPtr;
  635. typedef CALLBACK_API( UInt16 , PCCardCSClientProcPtr )(ClientCallbackPBPtr ccPBPtr);
  636. typedef STACK_UPP_TYPE(PCCardCSClientProcPtr)                     PCCardCSClientUPP;
  637. enum { uppPCCardCSClientProcInfo = 0x000000E0 };                 /* pascal 2_bytes Func(4_bytes) */
  638. #define NewPCCardCSClientProc(userRoutine)                         (PCCardCSClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPCCardCSClientProcInfo, GetCurrentArchitecture())
  639. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)             CALL_ONE_PARAMETER_UPP((userRoutine), uppPCCardCSClientProcInfo, (ccPBPtr))
  640. struct RegisterClientPB {
  641.     UInt32                             clientHandle;                /* <-  client descriptor*/
  642.     PCCardCSClientUPP                 clientEntry;                /*  -> universal procPtr to client's event handler*/
  643.     UInt16                             attributes;                    /*  -> bitmap of client attributes*/
  644.     UInt16                             eventMask;                    /*  -> bitmap of events to notify client*/
  645.     Ptr                             clientData;                    /*  -> pointer to client's data*/
  646.     UInt16                             version;                    /*  -> Card Services version this client expects*/
  647. };
  648. typedef struct RegisterClientPB RegisterClientPB;
  649.  
  650. /*    ‘attributes’ field values (see GetClientInfo)*/
  651. /*
  652.       kCSMemoryClient                    = 0x0001,
  653.       kCSIOClient                        = 0x0004,
  654.       kCSShareableCardInsertEvents    = 0x0008,
  655.       kCSExclusiveCardInsertEvents    = 0x0010
  656. */
  657.  
  658.  
  659. /*----------------        CSReleaseConfiguration            ----------------*/
  660.  
  661. struct ReleaseConfigurationPB {
  662.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  663.     UInt16                             socket;                        /*  -> */
  664. };
  665. typedef struct ReleaseConfigurationPB ReleaseConfigurationPB;
  666.  
  667. /*----------------        CSResetCard                        ----------------*/
  668.  
  669. struct ResetCardPB {
  670.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  671.     UInt16                             socket;                        /*  -> */
  672.     UInt16                             attributes;                    /*  -> xxx*/
  673. };
  674. typedef struct ResetCardPB ResetCardPB;
  675.  
  676. /*----------------        CSValidateCIS                    ----------------*/
  677.  
  678. struct ValidateCISPB {
  679.     UInt16                             socket;                        /*  -> */
  680.     UInt16                             chains;                        /*  -> whether link/null tuples should be included*/
  681. };
  682. typedef struct ValidateCISPB ValidateCISPB;
  683.  
  684. /*
  685.   ----------------        CSRequestIO                        ----------------
  686.   ----------------        CSReleaseIO                        ----------------
  687. */
  688.  
  689. struct ReqRelIOPB {
  690.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  691.     UInt16                             socket;                        /*  -> socket number*/
  692.     UInt16                             reserved;
  693.     UInt16                             basePort1;                    /*    ->    base I/O port for range*/
  694.     UInt8                             numPorts1;                    /*    ->    number of ports (e.g., bytes).*/
  695.     UInt8                             attributes1;                /*    ->    attributes*/
  696.  
  697.     UInt16                             basePort2;                    /*    ->    base I/O port for range*/
  698.     UInt8                             numPorts2;                    /*    ->    number of ports*/
  699.     UInt8                             attributes2;                /*    ->    attributes*/
  700.  
  701.     UInt8                             ioAddrLines;                /*    -> number of I/O lines decoded by card*/
  702.     UInt8                             reserved1;
  703. };
  704. typedef struct ReqRelIOPB ReqRelIOPB;
  705.  
  706. /*----------------        CSVendorSpecific                ----------------*/
  707. struct VendorSpecificPB {
  708.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  709.     UInt16                             vsCode;
  710.     UInt16                             socket;
  711.     UInt32                             dataLen;                    /*  -> length of buffer pointed to by vsDataPtr*/
  712.     UInt8 *                            vsDataPtr;                    /*  -> Card Services version this client expects*/
  713. };
  714. typedef struct VendorSpecificPB VendorSpecificPB;
  715.  
  716. /*    ‘vsCode’ field values*/
  717.  
  718.  
  719. enum {
  720.     vsAppleReserved                = 0x0000,
  721.     vsEjectCard                    = 0x0001,
  722.     vsGetCardInfo                = 0x0002,
  723.     vsEnableSocketEvents        = 0x0003,
  724.     vsGetCardLocationIcon        = 0x0004,
  725.     vsGetCardLocationText        = 0x0005,
  726.     vsGetAdapterInfo            = 0x0006
  727. };
  728.  
  729. /*
  730.   ///////////////////////////////////////////////////////////////////////////////////////
  731.       GetAdapterInfo parameter block (vendor-specific call #6)
  732. */
  733.  
  734. struct GetAdapterInfoPB {
  735.     UInt32                             attributes;                    /* <-  capabilties of socket's adapter*/
  736.     UInt16                             revision;                    /* <-  id of adapter*/
  737.     UInt16                             reserved;                    /* */
  738.     UInt16                             numVoltEntries;                /* <-  number of valid voltage values*/
  739.     UInt8 *                            voltages;                    /* <-> array of BCD voltage values*/
  740. };
  741. typedef struct GetAdapterInfoPB GetAdapterInfoPB;
  742.  
  743. /*    ‘attributes’ field values*/
  744.  
  745. enum {
  746.     kCSLevelModeInterrupts        = 0x00000001,
  747.     kCSPulseModeInterrupts        = 0x00000002,
  748.     kCSProgrammableWindowAddr    = 0x00000004,
  749.     kCSProgrammableWindowSize    = 0x00000008,
  750.     kCSSocketSleepPower            = 0x00000010,
  751.     kCSSoftwareEject            = 0x00000020,
  752.     kCSLockableSocket            = 0x00000040,
  753.     kCSInUseIndicator            = 0x00000080
  754. };
  755.  
  756. /*
  757.   ///////////////////////////////////////////////////////////////////////////////////////
  758.       GetCardInfo parameter block (vendor-specific call #2)
  759. */
  760.  
  761. struct GetCardInfoPB {
  762.     UInt8                             cardType;                    /* <-  type of card in this socket (defined at top of file)*/
  763.     UInt8                             subType;                    /* <-  more detailed card type (defined at top of file)*/
  764.     UInt16                             reserved;                    /* <-> reserved (should be set to zero)*/
  765.     UInt16                             cardNameLen;                /*  -> maximum length of card name to be returned*/
  766.     UInt16                             vendorNameLen;                /*  -> maximum length of vendor name to be returned*/
  767.     UInt8 *                            cardName;                    /*  -> pointer to card name string (read from CIS), or nil*/
  768.     UInt8 *                            vendorName;                    /*  -> pointer to vendor name string (read from CIS), or nil*/
  769. };
  770. typedef struct GetCardInfoPB GetCardInfoPB;
  771.  
  772. /*    GetCardInfo card types*/
  773.  
  774. enum {
  775.     kCSUnknownCardType            = 0,
  776.     kCSMultiFunctionCardType    = 1,
  777.     kCSMemoryCardType            = 2,
  778.     kCSSerialPortCardType        = 3,
  779.     kCSSerialOnlyType            = 0,
  780.     kCSDataModemType            = 1,
  781.     kCSFaxModemType                = 2,
  782.     kCSFaxAndDataModemMask        = (kCSDataModemType | kCSFaxModemType),
  783.     kCSVoiceEncodingType        = 4,
  784.     kCSParallelPortCardType        = 4,
  785.     kCSFixedDiskCardType        = 5,
  786.     kCSUnknownFixedDiskType        = 0,
  787.     kCSATAInterface                = 1,
  788.     kCSRotatingDevice            = (0 << 7),
  789.     kCSSiliconDevice            = (1 << 7),
  790.     kCSVideoAdaptorCardType        = 6,
  791.     kCSNetworkAdaptorCardType    = 7,
  792.     kCSAIMSCardType                = 8,
  793.     kCSNumCardTypes                = 9
  794. };
  795.  
  796.  
  797. #ifndef __PCCARDENABLERPLUGIN__
  798. /*
  799.     NOTE: These prototypes conflict with PCCardEnablerPlugin.≈
  800.           You cannot use both PCCardEnablerPlugin.h and CardServices.h
  801.           
  802. */
  803. EXTERN_API( OSErr )
  804. CSVendorSpecific                (VendorSpecificPB *        pb)                                    TWOWORDINLINE(0x7000, 0xAAF0);
  805.  
  806. EXTERN_API( OSErr )
  807. CSRegisterClient                (RegisterClientPB *        pb)                                    TWOWORDINLINE(0x7001, 0xAAF0);
  808.  
  809. EXTERN_API( OSErr )
  810. CSDeregisterClient                (RegisterClientPB *        pb)                                    TWOWORDINLINE(0x7002, 0xAAF0);
  811.  
  812. EXTERN_API( OSErr )
  813. CSGetFirstTuple                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7003, 0xAAF0);
  814.  
  815. EXTERN_API( OSErr )
  816. CSGetNextTuple                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7004, 0xAAF0);
  817.  
  818. EXTERN_API( OSErr )
  819. CSGetTupleData                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7005, 0xAAF0);
  820.  
  821. EXTERN_API( OSErr )
  822. CSGetConfigurationInfo            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x7006, 0xAAF0);
  823.  
  824. EXTERN_API( OSErr )
  825. CSGetCardServicesInfo            (GetCardServicesInfoPB * pb)                                TWOWORDINLINE(0x7007, 0xAAF0);
  826.  
  827. EXTERN_API( OSErr )
  828. CSGetStatus                        (GetStatusPB *            pb)                                    TWOWORDINLINE(0x7008, 0xAAF0);
  829.  
  830. EXTERN_API( OSErr )
  831. CSValidateCIS                    (ValidateCISPB *        pb)                                    TWOWORDINLINE(0x7009, 0xAAF0);
  832.  
  833. EXTERN_API( OSErr )
  834. CSGetFirstClient                (GetClientPB *            pb)                                    TWOWORDINLINE(0x700F, 0xAAF0);
  835.  
  836. EXTERN_API( OSErr )
  837. CSGetNextClient                    (GetClientPB *            pb)                                    TWOWORDINLINE(0x7010, 0xAAF0);
  838.  
  839. EXTERN_API( OSErr )
  840. CSGetClientInfo                    (GetClientInfoPB *        pb)                                    TWOWORDINLINE(0x7011, 0xAAF0);
  841.  
  842. EXTERN_API( OSErr )
  843. CSResetCard                        (ResetCardPB *            pb)                                    TWOWORDINLINE(0x7012, 0xAAF0);
  844.  
  845. EXTERN_API( OSErr )
  846. CSRequestWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7013, 0xAAF0);
  847.  
  848. EXTERN_API( OSErr )
  849. CSModifyWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7014, 0xAAF0);
  850.  
  851. EXTERN_API( OSErr )
  852. CSReleaseWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7015, 0xAAF0);
  853.  
  854. EXTERN_API( OSErr )
  855. CSRequestConfiguration            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701B, 0xAAF0);
  856.  
  857. EXTERN_API( OSErr )
  858. CSModifyConfiguration            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701C, 0xAAF0);
  859.  
  860. EXTERN_API( OSErr )
  861. CSAccessConfigurationRegister    (AccessConfigurationRegisterPB * pb)                        TWOWORDINLINE(0x701D, 0xAAF0);
  862.  
  863. EXTERN_API( OSErr )
  864. CSReleaseConfiguration            (ReleaseConfigurationPB * pb)                                TWOWORDINLINE(0x701E, 0xAAF0);
  865.  
  866. EXTERN_API( OSErr )
  867. CSGetClientEventMask            (GetSetClientEventMaskPB * pb)                                TWOWORDINLINE(0x701F, 0xAAF0);
  868.  
  869. EXTERN_API( OSErr )
  870. CSSetClientEventMask            (GetSetClientEventMaskPB * pb)                                TWOWORDINLINE(0x7020, 0xAAF0);
  871.  
  872. EXTERN_API( OSErr )
  873. CSRequestSocketMask                (ReqRelSocketMaskPB *    pb)                                    TWOWORDINLINE(0x7021, 0xAAF0);
  874.  
  875. EXTERN_API( OSErr )
  876. CSReleaseSocketMask                (ReqRelSocketMaskPB *    pb)                                    TWOWORDINLINE(0x7022, 0xAAF0);
  877.  
  878.  
  879. /*
  880.       Additional calls which are required for all I/O clients when running on
  881.       systems which do not reserve dedicated I/O-spaces for each PC Card.
  882. */
  883.  
  884. EXTERN_API( OSErr )
  885. CSRequestIO                        (ReqRelIOPB *            pb)                                    TWOWORDINLINE(0x7025, 0xAAF0);
  886.  
  887. EXTERN_API( OSErr )
  888. CSReleaseIO                        (ReqRelIOPB *            pb)                                    TWOWORDINLINE(0x7026, 0xAAF0);
  889.  
  890. #endif  /*  ! defined(__PCCARDENABLERPLUGIN__)  */
  891.  
  892.  
  893. #if PRAGMA_STRUCT_ALIGN
  894.     #pragma options align=reset
  895. #elif PRAGMA_STRUCT_PACKPUSH
  896.     #pragma pack(pop)
  897. #elif PRAGMA_STRUCT_PACK
  898.     #pragma pack()
  899. #endif
  900.  
  901. #ifdef PRAGMA_IMPORT_OFF
  902. #pragma import off
  903. #elif PRAGMA_IMPORT
  904. #pragma import reset
  905. #endif
  906.  
  907. #ifdef __cplusplus
  908. }
  909. #endif
  910.  
  911. #endif /* __CARDSERVICES__ */
  912.  
  913.